﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Common.Utils;
using Common.Exp2D;

namespace Experiments2D.Bublz
{
    class Bubble2D : Object2D
    {
        public const int DeadBubbleKind = 99;

        public Bubble2D(Texture2D texture, int kind, SpecialBubbleKind bonusKind)
            : base (texture , Vector2.Zero, false)
        {
            m_kind = kind;
            m_bonusKind = bonusKind;
        }

        protected int m_i;
        public int I
        {
            get { return m_i; }
            set { m_i = value; }
        }

        protected int m_j;
        public int J
        {
            get { return m_j; }
            set { m_j = value; }
        }

        protected bool m_visited;
        public bool Visited
        {
            get { return m_visited; }
            set { m_visited = value; }
        }

        protected bool m_setToBeRemoved;
        public bool SetToBeRemoved
        {
            get { return m_setToBeRemoved; }
            set { m_setToBeRemoved = true; }
        }

        protected bool m_connectedToTop;
        public bool ConnectedToTop
        {
            get { return m_connectedToTop; }
            set { m_connectedToTop = value; }
        }

        public Rectangle Rectangle
        {
            get
            {
               return new Rectangle((int)m_position.X, (int)m_position.Y, m_texture.Width, m_texture.Height);
            }
        }

        public int Width
        {
            get { return (m_texture != null) ? m_texture.Width : 0; }
        }

        public int Height
        {
            get { return (m_texture != null) ? m_texture.Height: 0; }
        }        

        private void SetTransparency(byte alpha)
        {
            m_color.A = alpha;
        }

        private int m_kind;
        public int Kind
        {
            get { return m_kind; }
            set { m_kind = value; }
        }


        private SpecialBubbleKind m_bonusKind;
        public SpecialBubbleKind BonusKind
        {
            get { return m_bonusKind; }
            set { m_bonusKind = value; }
        }

        public void SetDefaultParams(Color color, float posX, float posY, byte transparency)
        {
            this.Color = Color.White;
            this.m_position.X = posX;
            this.m_position.Y = posY;
            this.SetTransparency(transparency);
        }

    }

    public enum SpecialBubbleKind
    {
        None,
        Star
    }

    
}
